home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 4 / QRZ Ham Radio Callsign Database - Volume 4.iso / files / dsp / drbubtxt / toolstar.z / toolstar / tools / srec.h < prev   
Text File  |  1992-04-28  |  3KB  |  172 lines

  1. /**
  2. *    SREC Definitions
  3. **/
  4.  
  5. #define TRUE    1
  6. #define FALSE    0
  7. #define YES    1
  8. #define NO    0
  9. #define EOS    '\0'            /* end-of-string constant */
  10. #define MAXSTR    256            /* maximum string size + 1 */
  11.  
  12. /*
  13. * The following definitions are for Macintosh Lightspeed C since that
  14. * environment does not support command line DEFINEs.  Remove comments
  15. * as necessary.
  16. */
  17. /*
  18. #define MAC        1
  19. #define LSC        1
  20. */
  21.  
  22. /**
  23. *    Environment Definitions (zero here; may be redefined at compile time)
  24. **/
  25.  
  26. #ifndef MSDOS
  27. #define MSDOS        0        /* MS-DOS operating system */
  28. #endif
  29. #ifndef VMS
  30. #define VMS        0        /* VMS operating system */
  31. #endif
  32. #ifndef ATT
  33. #define ATT        0        /* AT&T Unix */
  34. #endif
  35. #ifndef BSD
  36. #define BSD        0        /* Berkeley Unix */
  37. #endif
  38. #ifndef MACH
  39. #define MACH        0        /* NeXT Mach */
  40. #endif
  41. #ifdef UNIX
  42. #undef UNIX
  43. #endif
  44. #define UNIX        (ATT || BSD || MACH)    /* generic Unix OS */
  45. #ifndef MAC
  46. #define MAC        0        /* Macintosh operating system */
  47. #endif
  48.  
  49. #ifndef MSC
  50. #define MSC        0        /* Microsoft C compiler */
  51. #endif
  52. #ifndef VAXC
  53. #define VAXC        0        /* VAX C compiler */
  54. #endif
  55. #ifndef LSC
  56. #define LSC        0        /* Lightspeed C compiler */
  57. #endif
  58. #ifndef MPW
  59. #define MPW        0        /* MPW C (Macintosh) */
  60. #endif
  61. #ifndef AZTEC
  62. #define AZTEC        0        /* Aztec C (Macintosh) */
  63. #endif
  64.  
  65. #if BSD
  66. #define strchr    index
  67. #define strrchr    rindex
  68. #else
  69. #define index    strchr
  70. #define rindex    strrchr
  71. #endif
  72.  
  73. #if AZTEC        /* text file routine redefintion for Aztec */
  74. #ifdef fgetc
  75. #undef fgetc
  76. #endif
  77. #define    fgetc    agetc
  78. #ifdef fputc
  79. #undef fputc
  80. #endif
  81. #define    fputc    aputc
  82. #endif
  83.  
  84. #if VMS                /* exit status values */
  85. #define OK    0x18000001L
  86. #define    ERR    0x1800FFFBL
  87. #define CLI_ABSENT    CLI$_ABSENT
  88. #else
  89. #define OK    0
  90. #define ERR    1
  91. #define CLI_ABSENT    0
  92. #endif
  93.  
  94. /*    Base filename lengths    */
  95. #if MSDOS
  96. #define BASENAMLEN    12
  97. #endif
  98. #if ATT
  99. #define BASENAMLEN    14
  100. #endif
  101. #if BSD || MACH
  102. #define BASENAMLEN    255
  103. #endif
  104. #if VMS
  105. #define    BASENAMLEN    78
  106. #endif
  107. #if MAC
  108. #define BASENAMLEN    31
  109. #endif
  110. #define MAXEXTLEN    4        /* longest filename extension */
  111.  
  112. #define DSP56000    1
  113. #define WSIZE5        3        /* bytes per 56000 word */
  114. #define OVRHD5        3        /* 56000 S-record byte overhead */
  115. #define WRDFMT5        "%06lx"        /* 56000 word format string */
  116.  
  117. #define DSP96000    2
  118. #define WSIZE9        4        /* bytes per 96000 word */
  119. #define OVRHD9        5        /* 96000 S-record byte overhead */
  120. #define WRDFMT9        "%08lx"        /* 96000 word format string */
  121.  
  122. #define DSP5616        3
  123. #define WSIZE6        2        /* bytes per 5616 word */
  124. #define OVRHD6        3        /* 5616 S-record byte overhead */
  125. #define WRDFMT6        "%04lx"        /* 5616 word format string */
  126.  
  127. #define S0OVRHD        3        /* S0 record overhead */
  128. #define MAXBYTE        30        /* max data bytes per S-record */
  129. #define MAXOVRHD    8        /* maximum S-record overhead */
  130. #define MAXBUF    (MAXBYTE + MAXOVRHD) * 2/* maximum byte buffer size */
  131.  
  132. #define MSPACES    4            /* number of memory spaces */
  133. #define XMEM    0            /* memory space array offsets */
  134. #define YMEM    1
  135. #define LMEM    2
  136. #define PMEM    3
  137.  
  138. #define NONE    0            /* OMF record codes */
  139. #define START    1
  140. #define END    2
  141. #define DATA    3
  142. #define BDATA    4
  143. #define SYMBOL    5
  144. #define COMMENT    6
  145.  
  146. #define RECORD    1            /* OMF field types */
  147. #define HEXVAL    2
  148.  
  149. #define NEWREC    '_'            /* new record indicator */
  150.  
  151. struct srec {                /* S-record structure */
  152.         FILE *fp;
  153.         unsigned checksum;
  154.         char *p;
  155.         char buf[MAXBUF + 1];
  156.         };
  157.  
  158. char *strcpy (), *strncpy ();
  159. char *strcat (), *strncat ();
  160. #if BSD
  161. char *sprintf ();
  162. char *index (), *rindex ();
  163. #else
  164. char *strchr (), *strrchr ();
  165. #endif
  166.  
  167. #if MSDOS        /* reference DOS version number */
  168. #if MSC
  169. extern unsigned char _osmajor;
  170. #endif
  171. #endif
  172.